#ifndef ERRORLOG_H
#define ERRORLOG_H

#include <QList>
#include <QString>
class Node;
#include "parser_yacc.h"

class ErrorLog
{
public:
    enum ErrorKind
    {
        Error,
        Warning
    };

    static void error( const YYLTYPE& loc, const QString& message );
    static void warning( const YYLTYPE& loc, const QString& message );

    static bool hasErrors();
    static bool hasWarnings();
    static int errorCount();
    static int warningCount();
    static bool isEmpty();

    static QString output();

private:
    ErrorLog() { }

    struct ErrorEntry
    {
        ErrorKind kind;
        YYLTYPE location;
        QString message;
    };

    static int s_errorCount;
    static int s_warningCount;
    static QList<ErrorEntry>* s_entries;
};

#endif // ERRORLOG_H
